package com.easy.merchants.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.easy.merchants.mapper.HouseImgMapper;
import com.easy.merchants.pojo.HouseImg;
import com.easy.merchants.service.HouseImgService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class HouseImgServiceImpl extends ServiceImpl<HouseImgMapper, HouseImg> implements HouseImgService {
    @Autowired
    private HouseImgMapper houseImgMapper;

    @Override
    public boolean selectByRid(Long rid) {
        HouseImg houseImg = new HouseImg();
        houseImg.setRid(rid);
        int row = houseImgMapper.selectCounts(houseImg);
        if (row > 0) {
            return true;
        }
        return false;
    }

    @Override
    public HouseImg selectImgByRid(Long rid) {
        HouseImg houseImg = new HouseImg();
        houseImg.setRid(rid);
        return houseImgMapper.selectHouseImg(houseImg);
    }

    @Override
    public boolean updateImgByRid(HouseImg houseImg) {
        int i = houseImgMapper.updateHouseImg(houseImg);
        if (i > 0) {
            return true;
        }
        return false;
    }
}
